#include <iostream>
#include <cstdio>
#include <sys/time.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <windows.h>
using namespace std;
const int n = 10000;
double a[10000],sum1[10000],sum2[10000];
double b[10000][10000];
int way1(int);
int way2(int);
ofstream outfile;
LARGE_INTEGER t1,t2,tc;

int main()
{
    outfile.open("output1.txt", ios::out);
    for(int i = 0;i < n;i++)
    {
        a[i] = i;
        for(int j = 0;j < n;j++)
        {
            b[i][j] = i + j;
        }
    }
    for(int i = 10;i <= n;i+=10)
    {
        outfile << i << ",";
        way1(i);
        way2(i);
    }
    return 0;
}

int way1(int nn)
{
    double s = 0.0;
    QueryPerformanceFrequency(&tc);
    QueryPerformanceCounter(&t1);
    for(int o = 0.0;o <100.0;o++)
    {
        for(int i = 0;i < nn;i++)
        {
            sum1[i] = 0.0;
            for(int j = 0;j < nn;j++)
            {
                sum1[i] += b[j][i] * a[j];
            }
        }
    }
    QueryPerformanceCounter(&t2);
	outfile<<((t2.QuadPart - t1.QuadPart)*1.0 / tc.QuadPart)*10.0<<"ms"<<",";
	return 0.0;
}

int way2(int nn)
{
    double s = 0.0;
    QueryPerformanceFrequency(&tc);
    QueryPerformanceCounter(&t1);
    for(int o = 0.0;o <100.0;o++)
    {
        for(int i = 0;i < nn;i++)
        {
            sum2[i] = 0.0;
        }
        for(int j=0;j < nn;j++)
        {
            for(int i = 0;i < nn;i++)
            {
                sum2[i] += b[j][i]*a[j];
            }
        }
    }
    QueryPerformanceCounter(&t2);
	outfile<<((t2.QuadPart - t1.QuadPart)*1.0 / tc.QuadPart)*10.0<<"ms"<<endl;
	return 0.0;
}
